package com.bozhong.config.exception;

/**
 * Created by renyueliang on 16/12/29.
 */
public class ConfigException extends RuntimeException {


    private static final long serialVersionUID = 1L;

    private String errorCode;

    private String msg;

    public ConfigException() {

    }

    public ConfigException(String errorCode, String message) {
        super(errorCode);
        setMsg(message);
        setErrorCode(errorCode);
    }

    public ConfigException(String errorCode, String message, Throwable cause) {
        super(errorCode, cause);
        setMsg(message);
        setErrorCode(errorCode);
    }
    public ConfigException(Throwable cause) {
        super(cause);
        setMsg(cause.getMessage());
    }


    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorCode() {
        return errorCode;
    }

    @Override
    public String toString() {
        return "{" +
                "\"errorCode\":\"" + errorCode + '\"' +
                ", \"msg\":\"" + msg + '\"' +
                '}';
    }
}
